package com.lap.analysis.tools;

import com.lap.framework.tools.Named;

/**
 * junit 工具
 *
 * @author Shuisheng Lao(劳水生)
 * @version 0.0.1
 */
public final class ProjectUtil {
  private static final String SLASH = "/";

  private static final String TEST_JAVA = "/src/test/java/";

  private static final String TEST_RESOURCES = "/src/test/resources/";

  private static final String SRC_JAVA = "/src/main/java/";

  private ProjectUtil() {}

  public static String getProjectDir() {
    return System.getProperty("user.dir");
  }

  public static String getJavaPath() {
    return getProjectDir() + SRC_JAVA;
  }

  public static String getTestPath(String packageName) {
    String packagePath = Named.periods2Path(packageName);
    return getProjectDir()
        + TEST_JAVA
        + (packagePath.endsWith(SLASH) ? packagePath : packagePath + SLASH);
  }

  public static String getCvsPath(String parentPath) {
    return getProjectDir()
        + TEST_RESOURCES
        + (parentPath.endsWith(SLASH) ? parentPath : parentPath + SLASH);
  }
}
